// 将base64转换为文件
function dataUrlToFile (dataurl, filename) {
	let arr = dataurl.split(',')
	let mime = arr[0].match(/:(.*?);/)[1]
	let bstr = atob(arr[1])
	let num = bstr.length
	let u8arr = new Uint8Array(num)
	while (num--) {
		u8arr[num] = bstr.charCodeAt(num)
	}
	return new File([u8arr], filename, {
		type: mime
	})
}

export default dataUrlToFile
